package com.tedu.charging.service.user.dao;

import com.tedu.charging.service.user.pojo.po.ChargingUserInfoPO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
* @author zjj
* @description 针对表【charging_user_info】的数据库操作Mapper
* @createDate 2023-08-11 11:03:45
* @Entity com.tedu.charging.service.cost.pojo.po.ChargingUserInfo
*/
public interface ChargingUserInfoMapper extends BaseMapper<ChargingUserInfoPO> {
//不加@Param会出错
    @Update("UPDATE charging_user_info\n" +
            "SET balance=#{amount}\n" +
            "WHERE id=#{userId}")
    public Integer  updateBalance(@Param("userId") Integer userId,@Param("amount") BigDecimal amount);

    @Update("UPDATE charging_user_info\n" +
            "SET balance=balance+#{amount}\n" +
            "WHERE id=#{userId}")
    public Integer  recharge(@Param("userId") Integer userId,@Param("amount") BigDecimal amount);
}




